<template>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column type="expand">
      <template slot-scope="props">
        <el-form label-position="left" inline class="demo-table-expand">

          <el-form-item label="产品编号">
            <span>{{ props.row.productId }}</span>
          </el-form-item>

          <el-form-item label="产品名称">
            <span>{{ props.row.name }}</span>
          </el-form-item>

          <el-form-item label="年利率">
            <span>{{ props.row.annualProfitRate }}</span>
          </el-form-item>

          <el-form-item label="起息日期">
            <span>{{ props.row.startDate }}</span>
          </el-form-item>

          <el-form-item label="到期日期">
            <span>{{ props.row.endDate }}</span>
          </el-form-item>

          <el-form-item label="预期收益">
            <span>{{ props.row.interest }}</span>
          </el-form-item>

          <el-form-item label="期限">
            <span>{{ props.row.term }}</span>
          </el-form-item>

        </el-form>
      </template>

    </el-table-column>

    <el-table-column label="商品 ID" prop="id"> </el-table-column>
    <el-table-column label="商品名称" prop="name"> </el-table-column>
    <el-table-column label="期限" prop="validity"> </el-table-column>
  </el-table>
</template>

<script>
import { getOrderList } from "@/api/order";

export default {
  name: "OrderList",
  data() {
    return {
      //   tableData 可以为空
      tableData: [],
      account: ''
    };
  },
  created() {
    this.account = this.$store.getters.getAccount;
    // 查询orderinfo 返回一个对象数组 tableData
    // axios.get
    this.getList(this.account)
  },
  methods: {
    getList(account) {
      getOrderList(account).then(res => {
        this.tableData = res.data;
      })
    }
  },
};
</script>

<style>
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>